unit SCApproving;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dRoot, cxStyles, dxSkinsCore, dxSkinBlack, dxSkinBlue,
  dxSkinCaramel, dxSkinCoffee, dxSkinDarkSide, dxSkinGlassOceans,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, dxSkinPumpkin, dxSkinSilver, dxSkinStardust,
  dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, dxSkinscxPCPainter, cxCustomData, cxGraphics,
  cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox,
  cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxClasses, cxControls, cxGridCustomView, cxGrid, IBCustomDataSet,
  IBQuery, StdCtrls, Buttons, ExtCtrls, ComCtrls;

type
  TfmSCApproving = class(TdlgRoot)
    qPeople: TIBQuery;
    dbgPeopleFind: TcxGrid;
    tvPeopleFind: TcxGridDBTableView;
    dbgPeopleFindLevel1: TcxGridLevel;
    qPeoplePID: TIntegerField;
    qPeoplePP: TIBStringField;
    qPeopleSCID: TIntegerField;
    qPeopleSCDATEBEGIN: TDateField;
    qPeopleSCDATEEND: TDateField;
    qPeopleSTNAME: TIBStringField;
    qPeopleSCTIMEENTER: TDateTimeField;
    qPeopleSCDATE: TDateField;
    tvPeopleFindPID: TcxGridDBColumn;
    tvPeopleFindPP: TcxGridDBColumn;
    tvPeopleFindSCID: TcxGridDBColumn;
    tvPeopleFindSCDATEBEGIN: TcxGridDBColumn;
    tvPeopleFindSCDATEEND: TcxGridDBColumn;
    tvPeopleFindSTNAME: TcxGridDBColumn;
    tvPeopleFindSCTIMEENTER: TcxGridDBColumn;
    qPeopleSCUSERENTER: TIBStringField;
    tvPeopleFindSCUSERENTER: TcxGridDBColumn;
    qPeopleSTSYSPODR: TIntegerField;
    qPeoplePODR: TIBStringField;
    tvPeopleFindPODR: TcxGridDBColumn;
    qPeopleSTSDIDTABEL: TIntegerField;
    procedure FormShow(Sender: TObject);
    procedure tvPeopleFindCellDblClick(Sender: TcxCustomGridTableView;
      ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
      AShift: TShiftState; var AHandled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmSCApproving: TfmSCApproving;

implementation
uses DBinv, InvProc, Invtypes, SCApproving_AddPodr;
{$R *.dfm}

procedure TfmSCApproving.FormShow(Sender: TObject);
begin
  inherited;
  qPeople.Close;
  qPeople.Open;
end;

procedure TfmSCApproving.tvPeopleFindCellDblClick(
  Sender: TcxCustomGridTableView;
  ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
  AShift: TShiftState; var AHandled: Boolean);
begin
  inherited;
  try
    if fmSCApproving_AddPodr = nil then
      fmSCApproving_AddPodr := TfmSCApproving_AddPodr.Create(self);
    fmSCApproving_AddPodr.dlgDS.DataSet := qpeople;
    fmSCApproving_AddPodr.stsdidtabel := qPeopleSTSDIDTABEL.AsInteger;
    fmSCApproving_AddPodr.cbApprov.Visible := False;
    fmSCApproving_AddPodr.gbPodrazd.Visible := False;
    if qPeopleSTSYSPODR.AsInteger = 2 then fmSCApproving_AddPodr.cbApprov.Visible := True;
    if qPeopleSTSYSPODR.AsInteger = 1 then fmSCApproving_AddPodr.gbPodrazd.Visible := True;

    if fmSCApproving_AddPodr.showModal = mrOk then begin
      qPeople.Close;
      qPeople.Open;
    end;
  finally
    fmSCApproving_AddPodr.Release;
    fmSCApproving_AddPodr := nil;
  end;
end;

end.

